package com.example.experiment4.service;


import com.example.experiment4.dao.PersonDao;
import com.example.experiment4.domain.Person;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.List;

@Component
public class PersonService {

    @Resource
    PersonDao personDao;


    public String saveData(List<Person> personList){
        Integer integer=0;
//        List<Person> personList = data.personList(filePath);
        for (int i = 0; i < personList.size(); i++) {
             integer = personDao.insertData(personList.get(i).getName(), personList.get(i).getAddress(), personList.get(i).getPhone());
        }

        if(integer>0) {
            return  "成功";
        }
        return "失败";

//        return "成功";



    }
}
